package com.wiscamp.ninechapters.panels.application.assemblers;


import com.wiscamp.ninechapters.panels.application.command.CreateMenuCommand;
import com.wiscamp.ninechapters.panels.application.command.UpdateMenuCommand;
import com.wiscamp.ninechapters.panels.application.vo.MenuVO;
import com.wiscamp.ninechapters.panels.application.vo.SimpleMenuVO;
import com.wiscamp.ninechapters.panels.domain.entities.Menu;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface MenuAssembler {
    MenuAssembler Instance = Mappers.getMapper(MenuAssembler.class);

    MenuVO toMenuVO(Menu entity);

    SimpleMenuVO toSimpleMenuVO(Menu entity);

    Menu fromCreateCommand(CreateMenuCommand createCommand);

    @Mapping(source = "operatorId", target = "modifierId")
    Menu fromUpdateCommand(UpdateMenuCommand updateCommand);

}
